/**
 * This library is a thing to realize D2L and DI and AOP on Flex2(ActionScript3).
 * Copyright (C) 2007 Takamasa Seki
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 * 
 * Contributor : Takamasa Seki(takanafu@gmail.com)
 *               http://www.takanafu.com/
 */

package com.takanafu.haruframework.d2l{
	import com.takanafu.core.haru_internal;
	
	import flash.display.DisplayObject;
	import flash.display.DisplayObjectContainer;
	import flash.events.Event;
	import flash.events.IEventDispatcher;
	import flash.utils.getQualifiedClassName;
	
	import mx.core.Application;
	import mx.core.FlexSprite;
	import mx.core.Singleton;
	import mx.core.UIComponent;
	import mx.core.mx_internal;
	import mx.managers.SystemManager;
	import mx.rpc.http.HTTPService;
	import mx.core.Singleton;
	import mx.core.IChildList;
	import mx.core.UIComponentDescriptor;
		
	use namespace haru_internal;

	[Mixin]
	public class HaRuManager implements IHaRuManager{
		public var _rootSystemManager:SystemManager;
		
		public function HaRuManager(sm:SystemManager){
  			super();
  			rootSystemManager = sm;
	  	}
	  	
	  	public function set rootSystemManager(sm:SystemManager):void{
	  		_rootSystemManager = sm;
	  	}
	  	public function get rootSystemManager():SystemManager{
	  		return _rootSystemManager;
	  	}
	  	
		public static function init(root:SystemManager):void{
			// �X�R�[�v�ύX�ɂ��C�� 20070817
			Singleton.registerClass("com.takanafu.haruframework.d2l.invoker::IInvocationProxy",
				Class(root.getDefinitionByName("com.takanafu.haruframework.d2l.invoker.InvocationProxyImpl")));
			//var ipi:IInvocationProxy = InvocationProxyImpl.getInstance();
			
			if(root.hasOwnProperty("contextData") == true){
				HaRu.appContextData = root["contextData"];
			} 
			HaRu.haru_internal::HaRuManager = new HaRuManager(root);
			HaRu.registBeans();
			HaRu.registPointcutAdvisor();
		}
	}
}